package com.CGFrame.struts.action;

import java.io.FileInputStream;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class ShowExcelAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		String filePath=request.getSession().getServletContext().getRealPath("/俊时开发任务总表1.xls");
		HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(filePath));
		request.setAttribute("workbook", workbook);
		return mapping.findForward("excel");
	}
	
}
